projects
/
project
/
bcm63xx
/
u-boot.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
68acb51
)
sandbox: eth-raw: Make sure descriptors are always initialized
author
Joe Hershberger
<
[email protected]
>
Mon, 2 Jul 2018 19:47:47 +0000
(14:47 -0500)
committer
Joe Hershberger
<
[email protected]
>
Thu, 26 Jul 2018 19:08:17 +0000
(14:08 -0500)
If we let descriptors equal 0, we can end up closing STDIN. Make sure
they start out as -1.
Signed-off-by: Joe Hershberger <
[email protected]
>
Reviewed-by: Simon Glass <
[email protected]
>
arch/sandbox/cpu/eth-raw-os.c
patch
|
blob
|
history
diff --git
a/arch/sandbox/cpu/eth-raw-os.c
b/arch/sandbox/cpu/eth-raw-os.c
index 61f23ed2104d9a4ad1ee5dfbe2783cf9d17ac0a5..4263d8829a30052b6de3a1f63314ca609967ff0e 100644
(file)
--- a/
arch/sandbox/cpu/eth-raw-os.c
+++ b/
arch/sandbox/cpu/eth-raw-os.c
@@
-34,6
+34,7
@@
static int _raw_packet_start(const char *ifname, unsigned char *ethmac,
int flags;
/* Prepare device struct */
+ priv->local_bind_sd = -1;
priv->device = malloc(sizeof(struct sockaddr_ll));
if (priv->device == NULL)
return -ENOMEM;
@@
-103,6
+104,8
@@
static int _local_inet_start(struct eth_sandbox_raw_priv *priv)
int one = 1;
/* Prepare device struct */
+ priv->local_bind_sd = -1;
+ priv->local_bind_udp_port = 0;
priv->device = malloc(sizeof(struct sockaddr_in));
if (priv->device == NULL)
return -ENOMEM;
@@
-136,8
+139,6
@@
static int _local_inet_start(struct eth_sandbox_raw_priv *priv)
strerror(errno));
return -errno;
}
- priv->local_bind_sd = -1;
- priv->local_bind_udp_port = 0;
return 0;
}